<?php
/**
 * 
 */
class AjaxController extends  Zend_Controller_Action {
	public $baseUrl;
	public function init(){  
		$auth = Zend_Auth::getInstance();
        if (!$auth->hasIdentity()){
           //
		   $this->_redirect("index/logout");
        }
	}
	public function openfileAction(){
		$sFileInfo = $this->_request->getParam('item');
		$arrFileInfo = explode('.',$sFileInfo);
		$FileObj = new System_Models_File();
		$arrFile = $FileObj->getFileView($arrFileInfo);
		$fileViewObj = new Clound_File(null,false);
		if($arrFile){
			$fileViewObj->_downloadfile($arrFile['FileName']);
		}
		die;
	}
	public function uploadAction(){
		$sRecordId = $this->_request->getParam('recordid');
		if(!$sRecordId){
			$upload_handler = new Clound_File();
		}else{
			//Lay mang file
			$arrFileInfo = explode('.',$sRecordId);
			$FileObj = new System_Models_File();
			$arrFile = $FileObj->getAllFileByRecordId($arrFileInfo);
			//var_dump($arrFile);exit;
			$upload_handler = new Clound_File(null,false);
			$upload_handler->_getFile($arrFile);
		}
		die;
	}
}
?>